package com.duan.DataCheckGW.groovy;

import groovy.lang.Binding;
import groovy.lang.GroovyShell;
import groovy.lang.Script;

import javax.script.Invocable;
import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;

public class GroovyUtil {
	public static Object runGroovyScript(String script1, String funName,Object [] params) {
        try {

			Binding binding = new Binding();  
			GroovyShell shell = new GroovyShell(binding);  
			Script script = shell.parse(script1);
            return script.invokeMethod(funName, params);
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
            return null;
        }
    }
}
